# -*- coding:utf-8 -*-
# 定义一个类，完成配置文件
from logging.handlers import RotatingFileHandler

import redis
import logging

class Config(object):
        SECRET_KEY = "izSY85Eo7ISlQnOqsJPdYPvTRj1KS+UDJKKn6XFCYrdrHo8OagmR5IO+Y9B/+m7hwhsGmgv1vDcrjfb9wBto/w=="
        DEBUG = True
        # 加载数据库配置
        SQLALCHEMY_DATABASE_URI="mysql://root:mysql@127.0.0.1:3306/ihome"
        SQLALCHEMY_TRACK_MODIFICATIONS = False
        # SQLAlCHEMY_TRACK_MODI
        REDIS_HOST = "192.168.20.129"
        REDIS_PORT = 6379
        SESSION_TYPE = "redis"
        SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
        PERMANENT_SESSION_LIFETIME = 86400 * 2
        LOGGING_LEVEL = logging.DEBUG

class DevelopmentConfig(Config):
    "开发环境的配置"
    DEBUG = True

class ProductionConfig(Config):
    "生产环境的配置"
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.0:3306/ihome1"

    # 添加日志的等级
    LOGGING_LEVEL = logging.WARN


config ={
    "DevelopmentConfig":DevelopmentConfig,
    "ProductionConfig":ProductionConfig
}